import 'package:flutter/material.dart';

class FormPage extends StatefulWidget {
  // 路由传参
  final String title;
  final int aid;
  const FormPage({super.key, this.title = '表单', required this.aid});

  @override
  State<FormPage> createState() => _FormPageState();
}

class _FormPageState extends State<FormPage> {
  @override
  void initState() {
    super.initState();
    print('ooooo-------------');
    // 获取组件的变量可以通过widget对象
    print(widget.aid);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            print('点返回了');
            Navigator.pop(context);
          },
          child: const Icon(Icons.back_hand),
        ),
        appBar: AppBar(title: Text(widget.title)),
        body: const Text('这是页面'));
  }
}
